<template>
	<view>
		<view class="p-2">
			<u--textarea height="400" :clearable="true" placeholder="请输入您的反馈意见" v-model="content" maxlength="500" count
				:border="true" />
			</u--textarea>
		</view>
		<view class="p-2">
			<u-input placeholder="请输入您的联系方式如(手机号/QQ号/微信号)" maxlength="30" v-model="contact" type="text"
				:border="true" />
		</view>
		<view class="p-2">
			<u-button @click="submit" :loading="btnloading" shape="circle"
				color="linear-gradient(-90deg,#1cc48c, #96E8BA)" text="立即提交"></u-button>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				contact: "",
				content: "",
				btnloading: false
			}
		},
		onShow() {
			this.btnloading = false
		},
		methods: {
			clear() {
				this.contact = ''
				this.content = ''
			},
			submit() {
				if (this.content == '' || this.content == undefined) {
					uni.showToast({
						title: "反馈意见不能为空",
						icon: "none"
					})
					return;
				}
				this.btnloading = true
				this.$http.requestApi('POST', 'ocr/user/setSuggest', {
					content: this.content,
					contact: this.contact,
					loginType: 1
				}).then(res => {
					this.btnloading = false;
					uni.showToast({
						title: res.msg,
						icon: "none"
					});
					if (res.status == 200) {
						this.clear()
					}
				}).catch(err => {
					this.btnloading = false
				})
			}
		}
	}
</script>

<style>

</style>